package com.lkk.cg.util;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

/**
 * Created by lkk on 2014/12/16.
 */
public class DateUtils {

    private Calendar calendar;

    public DateUtils() {
        this.calendar = new GregorianCalendar();
    }

    public DateUtils(int year, int month, int day) {
        this.calendar = new GregorianCalendar(year, month, day);
    }

    public int getYear() {
        return calendar.get(Calendar.YEAR);
    }

    public int getMonth() {
        return calendar.get(Calendar.MONTH);
    }

    public int getDayOfMonth() {
        return calendar.get(Calendar.DAY_OF_MONTH);
    }

    public Date firstSecondOfDay() {
        return new GregorianCalendar(getYear(), getMonth(), getDayOfMonth(), 0, 0).getTime();
    }

    public Date lastSecondOfDay() {
        return new GregorianCalendar(getYear(), getMonth(), getDayOfMonth(), 23, 59, 59).getTime();
    }
}
